package com.pro.common.api.depencies.config;

import com.pro.common.api.model.BaseModel;
import io.swagger.v3.oas.annotations.media.Schema;
import org.mapstruct.*;

@Schema(description = "复制属性时_忽略自动生成属性")
@MapperConfig
public interface CommonMappingConfig {
    @Mapping(target = "id", ignore = true)
    @Mapping(target = "createTime", ignore = true)
    @Mapping(target = "updateTime", ignore = true)
    @Mapping(target = "deleted", ignore = true)
    @BeanMapping(ignoreByDefault = false)// ignoreByDefault = false 不能去掉 会编译报错
    BaseModel ignoreBaseFields(Object source);

    @InheritConfiguration(name = "ignoreBaseFields")
    @Mapping(source = "id", target = "fromId")
    BaseModel ignoreBaseFieldsWithFromId(Object source);
}
